package com.school.hjt.schoolclasscard.fragment;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;

import com.school.hjt.schoolclasscard.R;

/**
 * Created by xqx on 2018/1/22.
 *
 */

public class WebFragment extends BaseFragment {
    private String url;
    @SuppressLint({"NewApi", "ValidFragment"})
    public WebFragment(String url) {
        this.url = url;
        Log.e("ATG","web    "+url);
    }
    public WebFragment(){

    }
        WebView web;
    @Override
    protected void initView(View view) {
        web = view.findViewById(R.id.web);
        web.setBackgroundColor(0);
        web.getSettings().setUseWideViewPort(true);
        web.getSettings().setJavaScriptEnabled(true);
        web.getSettings().setSupportZoom(true); //设置可以支持缩放
        web.getSettings().setDefaultZoom(WebSettings.ZoomDensity.FAR);
        web.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                //设置加载进度条
                return true;
            }
        });
        web.loadUrl(url);
        Log.e("ATG","    "+url);
    }
    @Override
    protected int getLayoutResource() {
        return R.layout.fragment_web;
    }

    @Override
    protected void loadData() {

    }
}
